package com.moji.controller.api;


import com.moji.common.base.ApiResult;
import com.moji.entity.MjOrder;
import com.moji.entity.dto.AddOrderDto;
import com.moji.entity.dto.QueryOrderDto;
import com.moji.entity.vo.FinanceOrderVo;
import com.moji.entity.vo.OrderVo;
import com.moji.service.MjOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2024-07-27
 */
@RestController
@RequestMapping("/api/Finance")
@Api(tags = "财务统计api相关接口", value = "财务统计api相关接口")
public class MjFinanceController {

    @Resource
    private MjOrderService mjOrderService;

    @PostMapping("/queryFinanceByPage")
    @ApiOperation(value = "财务统计",response = FinanceOrderVo.class)
    public ApiResult queryFinanceByPage(@RequestBody QueryOrderDto dto){
        return ApiResult.ok(mjOrderService.queryFinanceByPage(dto));
    }

    @GetMapping("/detail")
    @ApiOperation(value = "详情",response = OrderVo.class)
    public ApiResult detail(@RequestParam("id") Long id){
        return ApiResult.ok(mjOrderService.detail(id));
    }

    @PostMapping("/reportExport")
    @ApiOperation(value = "导出",response = Integer.class)
    public void reportExport(@RequestBody QueryOrderDto dto, HttpServletResponse response){
        mjOrderService.reportExport(dto,response);
    }

    @GetMapping("/test")
    @ApiOperation(value = "测试接口",response = OrderVo.class)
    public ApiResult test(){
        return ApiResult.ok(mjOrderService.test());
    }

}

